﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace Chromatics.Pages.CustomMessageBox
{
    public partial class CustomMessageBox : UserControl
    {
        private int count = 0;

        public CustomMessageBox()
        {
            InitializeComponent();
        }

        public void SetNextDisabled()
        {
            this.NextLevelBtn.IsEnabled = false;
        }

        public void SetNextEnabled()
        {
            this.NextLevelBtn.IsEnabled = true;
        }

        public void Run(int _count)
        {
            this.count = _count;
            switch (_count)
            {
                case 0:
                    {
                        this.Star1.Visibility = System.Windows.Visibility.Collapsed;
                        this.Star2.Visibility = System.Windows.Visibility.Collapsed;
                        this.Star3.Visibility = System.Windows.Visibility.Collapsed;
                        break;
                    }
                case 1:
                    {
                        this.Star1.Visibility = System.Windows.Visibility.Collapsed;
                        this.Star2.Visibility = System.Windows.Visibility.Collapsed;
                        this.Star3.Visibility = System.Windows.Visibility.Visible;
                        break;
                    }
                case 2:
                    {
                        this.Star1.Visibility = System.Windows.Visibility.Collapsed;
                        this.Star2.Visibility = System.Windows.Visibility.Visible;
                        this.Star3.Visibility = System.Windows.Visibility.Visible;
                        break;
                    }
                case 3:
                    {
                        this.Star1.Visibility = System.Windows.Visibility.Visible;
                        this.Star2.Visibility = System.Windows.Visibility.Visible;
                        this.Star3.Visibility = System.Windows.Visibility.Visible;
                        break;
                    }
            }
        }

        private void UserControl_IsEnabledChanged_1(object sender, DependencyPropertyChangedEventArgs e)
        {
            switch (this.count)
            {
                case 1:
                    {

                        this.Star3Animation.Begin();
                        break;
                    }
                case 2:
                    {

                        this.Star3Animation.Begin();
                        this.Star2Animation.Begin();
                        break;
                    }
                case 3:
                    {

                        this.Star3Animation.Begin();
                        this.Star2Animation.Begin();
                        this.Star1Animation.Begin();
                        break;
                    }
            }
        }
    }
}
